import { ref } from 'vue'

const isMobile = ref(false)

/**
 * 检测设备
 */
export const checkDevice = () => {
	const userAgent = navigator.userAgent || window.opera
	if (userAgent.match(/iPad/i) || userAgent.match(/iPhone/i) || userAgent.match(/iPod/i)) {
		// iOS
		isMobile.value = true
	} else if (userAgent.match(/Android/i)) {
		// Android
		isMobile.value = true
	}
	return isMobile.value
}